﻿using System;
using Budget.Core.Exceptions;

namespace Budget.Core.DomainModel
{
    public class IncomeOrder : BaseEntity
    {
        public virtual decimal Amount { get; set; }

        public virtual DateTime CreationDate { get; set; }

        public virtual IncomeType IncomeType { get; protected set; }

        public virtual Balance Balance { get; protected set; }

        protected IncomeOrder()
        {
        }

        public IncomeOrder(IncomeType incomeType, Balance balance)
        {
            Check.Require<ArgumentNullException>(incomeType != null, "incomeType");
            Check.Require<ArgumentNullException>(balance != null, "balance");

            incomeType.IncomeOrders.Add(this);
            IncomeType = incomeType;
            balance.IncomeOrders.Add(this);
            Balance = balance;
        }
    }
}